<?php
require_once('init.php');
$_GET['q'] = htmlescape($_GET['q']);
$results = $db->query('SELECT id, name FROM node WHERE name LIKE '.$db->quote('%'.$_GET['q'].'%') .' LIMIT 10');
header("Content-type: application/json; charset=UTF-8");
echo json_encode($results);